package o;

import android.content.Context;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.jetbrains.annotations.NotNull;

public class eto extends eui {
    private static final byte[] ˊ = new byte[0];
    private static eto ॱ = null;

    public static synchronized eto ˋ() {
        eto o_eto;
        synchronized (eto.class) {
            synchronized (ˊ) {
                if (ॱ == null) {
                    ॱ = new eto();
                }
                o_eto = ॱ;
            }
        }
        return o_eto;
    }

    private eto() {
        super("install_retry_task_manager");
    }

    public void ˎ(Context context) {
        fhz ˋ = fho.ˏ().ˋ("PackageManager");
        if (ˋ != null) {
            cny o_cny = (cny) ˋ.ॱ(cny.class);
            if (o_cny != null) {
                for (String str : ॱ()) {
                    Logger.ˎ("InstallRetryTaskManager", "delete expired task");
                    o_cny.ˊ(context, str);
                    ʼ(str);
                }
            }
        }
    }

    @NotNull
    private List<String> ॱ() {
        Set<Entry> entrySet = ʿ().entrySet();
        long currentTimeMillis = System.currentTimeMillis();
        List<String> arrayList = new ArrayList();
        for (Entry entry : entrySet) {
            Object value = entry.getValue();
            if ((value instanceof Long) && currentTimeMillis - ((Long) value).longValue() > HwAccountConstants.CHECK_SITE_COUNTRY_DURATION) {
                arrayList.add(entry.getKey());
            }
        }
        return arrayList;
    }

    public void ˎ(String str) {
        ˎ(str, System.currentTimeMillis());
    }
}
